// limits.cpp -- some integer limits
#include <iostream>
#include <climits>   // use limits.h for older systems

int main() {
    using namespace std;
    int n_int = INT_MAX;
    short n_short = SHRT_MAX;
    long n_long = LONG_MAX;
    long long n_llong = LLONG_MAX;

    // sizeof operator yields size of type or of variable
    cout << "int is " << sizeof(int) << " bytes." << endl;
    cout << "short is " << sizeof n_short << " bytes." << endl;
    cout << "long is " << sizeof n_long << " bytes." << endl;
    cout << "long long is " << sizeof n_llong << " bytes." << endl;
    cout << endl;

    cout << "Maximum value:" << endl;
    cout << "int: " << n_int << endl;
    cout << "short: " << n_short << endl;
    cout << "long: " << n_long << endl;
    cout << "long long: " << n_llong << endl << endl;

    cout << "Minimum int value = " << INT_MIN << endl;
    cout << "Bits per byte = " << CHAR_BIT << endl;

//    -----------------------------------------------------------
    cout << "----------------------------------------------------" << endl;
    int owls = 101; // traditional C initialization, sets owls to 101
    int wrens(432); // traditional C++ syntax, set wrens to 4324
    // C++11
    int emus{7};
    int rheas = {12};

    int rocs = {};  // set rocs to 0
    int psychics{}; // set psychics to 0

    cout << "owls = " << owls << endl;
    cout << "wrens = " << wrens << endl << endl;
    cout << "emus = " << emus << endl;
    cout << "rheas = " << rheas << endl << endl;
    cout << "rocs = " << rocs << endl;
    cout << "psychics = " << psychics << endl;
//    -----------------------------------------------------------
    cout << "----------------------------------------------------" << endl;
    int chest = 42;     // decimal integer literal
    int waist = 0x42;   // hexadecimal integer literal
    int inseam = 042;   // octal integer literal

    cout << "Monsieur cuts x striking figure!\n";
    cout << "chest = " << chest << " (42 head decimal)" << endl;
    cout << "waist = " << waist << " (0x42 head hex)" << endl;
    cout << "inseam = " << inseam << " (042 head octal)" << endl << endl;

    cout << hex;    // manipulator for changing number base
    cout << "chest:\n" << "   hex: " << chest << endl;
    cout << dec;    // manipulator for changing number base
    cout << "   decimal: " << chest << endl;
    cout << oct;    // manipulator for changing number base
    cout << "   octal: " << chest << endl;
    return 0;
}